import { DomUtils } from '../utils/DomUtilsMin';


export class Zhihu {
    
    static hostname = 'zhuanlan.zhihu.com';

    main() {
        console.clear();
        
        DomUtils.hide([
            document.querySelector('.css-wfkf2m')?.parentElement,
            '.MobileAppHeader',
            '.OpenInAppButton',
            '.oia-action-bar'
        ]);
        DomUtils.hide([
            '.OpenInAppButton'
        ], 'scale');

        DomUtils.observe('.Post-content', ['childList'], { childList: true }, ({ target, observer }) => {
            target.querySelector('.OpenInAppButton')?.remove();
        });

        DomUtils.observe(document.body, ['childList'], { childList: true }, ({ target }) => {
            const MobileModal = target.querySelector('.MobileModal-wrapper');
            if (MobileModal) {
                DomUtils.hide(MobileModal?.parentElement?.parentElement, 'scale');
                DomUtils.setCss(document.body, { position: 'unset', overflow: 'auto' });
            }
        });
    }
}